#pragma once

#include <string>

using namespace std;

struct ListNode
{
public:
	ListNode( const string& theString, ListNode* pNext = NULL )
	{
		word = theString;
		pNextNode = pNext;
	}

	string word;
	ListNode* pNextNode;
};

//add a node (pNode) at position (pos) of LinkedList (pHead).  
//if pos = 0 make pNode the new head
//if pos is greater than the number of nodes in the list, add the node to the end
//return a pointer to the head node
ListNode* addNode( ListNode* pHead, ListNode* pNode, int pos );

//remove (and cleanup after) the node in position (pos) of LinkedList (pHead)
//if pos = 0 assign a new head
//if pos is greater than the number of nodes in the list, remove the node at the end
//return a pointer to the head node
ListNode* removeNode( ListNode* pHead, int pos );

//traverse the LinkedList (pHead) and delete all nodes
//return a pointer to the head node
ListNode* removeAllNodes( ListNode* pHead );

//traverse the LinkedList (pHead) and create a string containing all the words in the list
//separated by a space
string getNodeReport( ListNode* pHead );